package net.news.entity;
// default package

import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import net.news.entity.NewsPeople;
import net.news.entity.NewsType;


/**
 * News entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="News"
    ,schema="dbo"
    ,catalog="CMUNEWS"
)

public class News  implements java.io.Serializable {


    // Fields    

     private Integer id;
     private NewsType newsType;
     private NewsPeople newsPeople;
     private String newsTitle;
     private String newText;
     private String newsImagePath;
     private String newsVideoPath;
     private Timestamp newsTime;
     private Integer clickRate=0;


    // Constructors

    /** default constructor */
    public News() {
    }

	/** minimal constructor */
    public News(NewsType newsType, NewsPeople newsPeople, String newsTitle) {
        this.newsType = newsType;
        this.newsPeople = newsPeople;
        this.newsTitle = newsTitle;
    }
    
    /** full constructor */
    public News(NewsType newsType, NewsPeople newsPeople, String newsTitle, String newText, String newsImagePath, String newsVideoPath, Timestamp newsTime, Integer clickRate) {
        this.newsType = newsType;
        this.newsPeople = newsPeople;
        this.newsTitle = newsTitle;
        this.newText = newText;
        this.newsImagePath = newsImagePath;
        this.newsVideoPath = newsVideoPath;
        this.newsTime = newsTime;
        this.clickRate = clickRate;
    }

   
    // Property accessors
    @Id @GeneratedValue
    
    @Column(name="id", unique=true, nullable=false)

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="newsTypeId", nullable=false)

    public NewsType getNewsType() {
        return this.newsType;
    }
    
    public void setNewsType(NewsType newsType) {
        this.newsType = newsType;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="newsPeopleId", nullable=false)

    public NewsPeople getNewsPeople() {
        return this.newsPeople;
    }
    
    public void setNewsPeople(NewsPeople newsPeople) {
        this.newsPeople = newsPeople;
    }
    
    @Column(name="newsTitle", nullable=false, length=50)

    public String getNewsTitle() {
        return this.newsTitle;
    }
    
    public void setNewsTitle(String newsTitle) {
        this.newsTitle = newsTitle;
    }
    
    @Column(name="newText")

    public String getNewText() {
        return this.newText;
    }
    
    public void setNewText(String newText) {
        this.newText = newText;
    }
    
    @Column(name="newsImagePath", length=1000)

    public String getNewsImagePath() {
        return this.newsImagePath;
    }
    
    public void setNewsImagePath(String newsImagePath) {
        this.newsImagePath = newsImagePath;
    }
    
    @Column(name="newsVideoPath", length=1000)

    public String getNewsVideoPath() {
        return this.newsVideoPath;
    }
    
    public void setNewsVideoPath(String newsVideoPath) {
        this.newsVideoPath = newsVideoPath;
    }
    
    @Column(name="newsTime", length=23)

    public Timestamp getNewsTime() {
        return this.newsTime;
    }
    
    public void setNewsTime(Timestamp newsTime) {
        this.newsTime = newsTime;
    }
    
    @Column(name="clickRate")

    public Integer getClickRate() {
        return this.clickRate;
    }
    
    public void setClickRate(Integer clickRate) {
        this.clickRate = clickRate;
    }
   








}